package dongnv.poweramp.activity;

import dongnv.poweramp.R;
import dongnv.poweramp.data.ListFolderAdapter;
import dongnv.poweramp.data.ListSongAdapter;
import dongnv.poweramp.data.SystemManager;
import dongnv.poweramp.screen.HomeScreen;

import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;

public class HomeActivity extends Activity {

	public static final SystemManager systemManager;
	static {
		systemManager = new SystemManager();
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		systemManager.setMessageHandler(createMessageHandle());
		systemManager.setListSongAdapter(new ListSongAdapter(getApplicationContext(), 0, systemManager.getArraySongItem()));
		systemManager.setListFolderAdapter(new ListFolderAdapter(getApplicationContext(), 0, systemManager.getArrayFolderItem()));
		homeScreen = new HomeScreen(getApplicationContext());
		setContentView(homeScreen.getView());
	}

	public Handler createMessageHandle() {

		Handler messageHandler = new Handler() {
			public void handleMessage(Message msg) {
				switch (msg.what) {
				default:
					break;
				}
			}
		};
		return messageHandler;
	}

//	@Override
//	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//		super.onActivityResult(requestCode, resultCode, data);
//		switch (requestCode) {
//		default:
//			break;
//		}
//	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		systemManager.removeMediaPlayer();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	private HomeScreen homeScreen;
}
